package tests;

public class StringParser {

	
	public void decodeMoney(){
		String test = "Jan: /send Joe 25";
		String sender;
		int sendEnd = test.indexOf(":");
		sender = test.substring(0, sendEnd);
		test = test.substring(sender.length());
		test = test.replaceAll(": /send ", "");
		String receiver = test;
		int recEnd = test.indexOf(" ");
		receiver = receiver.substring(0, recEnd);
		String amount;
		amount = test.substring(recEnd+1);
		System.out.println("Sender:"+sender + " Receiver:"+receiver+" Amt:"+amount);
	}
	
	/**
	 * Test class to attempt string literal parsing as commands
	 * String = "Jan: /send Joe 25"
	 * @param args
	 */
	public static void main(String[] args) {
		StringParser sp = new StringParser();
		sp.decodeMoney();
	}

}
